package domain.dao;

import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Query;

import domain.Action;
import domain.Command;
import domain.User;


/**
 * last change:  $Date$
 * by:           $Author$
 * revision:     $Revision$
 *
 */
public class CommandDao extends AbstractDao {
  
  public CommandDao() {
    super();
  }
  
  private final static String HQL_LOAD_COMMANDS = "from Command";
  
  public void loadCommands() {
    try {
      begin();
      Query query = getSession().createQuery(HQL_LOAD_COMMANDS);
      List<Command> commands = (List<Command>)query.list();
      for (Command command : commands) {
        System.out.println("Command: " + command.getTag() + " (" + command.getArgs() + ") {" + command.getId() + "}");
      }
      commit();
    } catch (HibernateException e) {
      rollback();
    }
  }
  
}
